//
// Created by guanyicheng on 2021/10/12.
//
#include "../../common.h"

class Solution {
public:
    int tribonacci(int n) {
        int a = 0, b = 1, c = 1;
        if (n < 3) {
            return n == 0 ? 0 : 1;
        }
        for (int i = 2; i < n; ++i) {
            int t = a + b + c;
            a = b;
            b = c;
            c = t;
        }
        return c;
    }
};

int main() {

    cout << Solution().tribonacci(25) << endl;
}